<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/table_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:01 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>H+ 后台主题UI框架 - 基础表格</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link rel="shortcut icon" href="favicon.ico"> <link href="/Public/Admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/Admin/css/animate.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="/Public/Admin/css/page.css" rel="stylesheet">
    <link href="/Public/Admin/css//plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="/Public/Admin/js/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="/Public/Admin/js/plugins/layer/laypage/skin/laypage.css" rel="stylesheet">
    <style>
        #litpic{width: 60px;height: 60px;}
    </style>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>管理员列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row m-b-sm m-t-sm">
                        <div class="col-md-2">
                            <a  class="btn btn-primary btn-outline active" href="<?php echo U('admin/add');?>" aria-pressed="true"><i class="fa fa-user-plus"></i>添加成员</a>
                        </div>
                        <form method="get" action="<?php echo U('Admin/index');?>">
                            <div class="col-md-5">
                                <div class="input-group">
                                    <input type="text" name="inquery" placeholder="请输入管理员名称" class="input-sm form-control" value="<?php echo ($inquery); ?>">
                                    <span class="input-group-btn"><button type="submit" class="btn btn-sm btn-primary"> <i class="fa fa-search"></i>搜索</button> </span>
                                </div>
                            </div>
                        </form>
                    </div>
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>用户名</th>
                                <th>真实姓名</th>
                                <th>头像</th>
                                <th>分组</th>
                                <th>登陆次数</th>
                                <th>IP</th>
                                <th>登录时间</th>
                                <th>状态:正常/禁用</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list): $mod = ($i % 2 );++$i;?><tr>
                                    <td><?php echo ($list["id"]); ?></td>
                                    <td><?php echo ($list["username"]); ?></td>
                                    <td><?php echo ($list["realname"]); ?></td>
                                    <td><img src="/<?php echo ($list["litpic"]); ?>" id ="litpic"></td>
                                    <td><?php echo ($list["title"]); ?></td>
                                    <td><?php echo ($list["loginnum"]); ?></td>
                                    <td><?php echo ($list["ip"]); ?></td>
                                    <td><?php echo (date('Y-m-d H:i:s',$list["logintime"])); ?></td>
                                    <?php if($list["id"] == 1 ): ?><td><a class="btn btn-primary btn-rounded disabled" href="#"><i class="fa fa-check"></i>正常</a></td>
                                        <?php elseif($list["status"] == 1 ): ?>
                                        <td><a class="btn btn-primary btn-rounded" href="javascript:changeAdmin(<?php echo ($list["id"]); ?>)" id="status<?php echo ($list["id"]); ?>"><i class="fa fa-check"></i>正常</a></td>
                                        <?php else: ?>
                                        <td><a class="btn btn-danger btn-rounded" href="javascript:changeAdmin(<?php echo ($list["id"]); ?>)" id="status<?php echo ($list["id"]); ?>"><i class="fa fa-remove"></i>禁用</a></td><?php endif; ?>
                                    <?php if($list["id"] == 1 ): ?><td><a class="btn btn-default btn-rounded disabled" href="#"><i class="fa fa-trash"></i>删除</a> <a class="btn btn-default btn-rounded disabled" href="#"><i class="fa fa-edit"></i>修改</a></td>
                                    <?php else: ?>
                                        <td><a class="btn btn-danger btn-rounded" href="javascript:delAdmin(<?php echo ($list["id"]); ?>)"><i class="fa fa-trash"></i>删除</a> <a class="btn btn-info btn-rounded" href="<?php echo U('admin/edit?id='.$list['id']);?>"><i class="fa fa-edit"></i>修改</a></td><?php endif; ?>
                                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                        </tbody>
                    </table>
                    <!--<div class="page">-->
                        <!--<?php echo ($page); ?>-->
                    <!--</div>-->
                    <div id="page" style ="text-align: center">

                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
<script src="/Public/Admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/Admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/Public/Admin/js/plugins/peity/jquery.peity.min.js"></script>
<script src="/Public/Admin/js/content.min.js?v=1.0.0"></script>
<script src="/Public/Admin/js/plugins/iCheck/icheck.min.js"></script>
<script src="/Public/Admin/js/demo/peity-demo.min.js"></script>
<script src="/Public/Admin/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="/Public/Admin/js/plugins/layer/layer.min.js"></script>
<script src="/Public/Admin/js/plugins/layer/laypage/laypage.js"></script>

<script>
    $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
</script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
<script>
    function delAdmin(id){
        var isConfirm;
        swal({
            title: "您确定要删除这条信息吗?",
            text: "删除后将无法恢复，请谨慎操作！",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "是的，我就是要删除！",
            cancelButtonText: "师傅刹一脚...",
            closeOnConfirm: false,
            closeOnCancel: false
        },
        function(isConfirm){
            if (isConfirm) {
                $.ajax({
                    type:"post",
                    url:"<?php echo U('admin/adminDel');?>",
                    dataType:"json",
                    data:{"id":id}
                }).done(function(data){
                    swal({
                        title:data.title,
                        text:data.msg,
                        type:data.status,
                        confirmButtonText: "OK！"
                    },function(){
                        window.location.href="<?php echo U('Admin/index');?>";
                    });
//                    swal(data.title, data.msg, data.status),
//                            goto();
                }).error(function(data) {
                    swal("OMG", "删除操作失败了!", "error")
                });
            } else {
                swal("已取消", "您取消了删除操作！", "error");
            }
        });
        function goto(){
            window.location.href="<?php echo U('Admin/index');?>";
        }
    }
    function changeAdmin(id){
        var object = $('#status'+id);
        var font = $('#font'+id);
        $.post(
            "<?php echo U('Admin/adminChange');?>",
            {id:id},
            function(data){
                if(data.status == 0){
                    layer.msg(data.msg, {icon: 5,time: 1000});
                }else{
                    if(data.state > 0){
                        object.html("<i class='fa fa-check'></i>正常</a>").removeClass("btn btn-danger btn-rounded").addClass("btn btn-primary btn-rounded");
                        layer.msg(data.msg, {icon: 6,time: 1000});
                    }else{
                        object.html("<i class='fa fa-remove'></i>禁用</a>").removeClass("btn btn-primary btn-rounded").addClass("btn btn-danger btn-rounded");
                        layer.msg(data.msg, {icon: 6,time: 1000});
                    }
                }
            },'json'
        );
    }
    $(function(){
        var inquery = '<?php echo ($inquery); ?>';
        laypage({
            cont:page,
            pages:<?php echo ($pages); ?>,
            skip:1,
            curr:function(){
                var page = location.search.match(/page=(\d+)/);
                return page ? page[1] : 1;
            }(),
            jump: function(e, first){
                //得到了当前页，用于向服务端请求对应数据
                if(!first){ //一定要加此判断，否则初始时会无限刷新
                    location.href = '?inquery='+inquery+'&page='+e.curr;
                }
            }
        });
    })

</script>
</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/table_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:01 GMT -->
</html>